home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3782 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  45 lines

  1. Path: mindlink.bc.ca!a10699
  2. From: Greg_Butler@mindlink.bc.ca (Greg Butler)
  3. Newsgroups: comp.lang.c
  4. Subject: Far pointer problem.
  5. Date: Tue, 30 Jan 96 21:09:09 -0800
  6. Organization: MIND LINK! - British Columbia, Canada
  7. Distribution: world
  8. Message-ID: <82967-823064949@mindlink.bc.ca>
  9. NNTP-Posting-Host: mindlink.net
  10.  
  11. Could someone help me with this odd problem? I am trying to pass a pointer
  12. from process A to process B so that process A can have knowlege of the
  13. location of a variable in process B. This would be like having a data
  14. transfer area that is shared between processes. I thought this would not be
  15. to difficult, but I am lost in C pointers. I tried to simulate the problem
  16. with the following small C routine. I have
  17. a variable in "process A" located at 6525:01c0, and I have a varable in
  18. "process B" called "thingone". I would like to have the address of
  19. "thingone"
  20. to be the contents of "6525:01c0". The address needs to be the segement and
  21. offset. I think I am close but I have been stairing at this code for a long
  22. time and am probably missing the obvious.
  23.  
  24. Thanks in advance.
  25.  
  26. /* test c program */
  27.  
  28. int     thingone;
  29. int     far *thingtwo;
  30.  
  31. main()
  32. {
  33.         thingtwo = (int far *)0x652501c0;
  34.         stub( &thingtwo );
  35. }
  36.  
  37. stub( int far **point )
  38. {
  39.         *point = &thingone;
  40.         thingone = 0xabcd;
  41. }
  42.  
  43. --
  44. Greg_butler@mindlink.bc.ca
  45.